package main

import (
	"fmt"
	"io/ioutil"
	"os"
	"strings"
)

func main() {
	counts := make(map[string]int)
	// _是索引, fileName是内容
	for _, fileName := range os.Args[0:] {
		// 将数据读取出来
		fmt.Printf("fileName: %s\n", fileName)
		data, err := ioutil.ReadFile(fileName)
		fmt.Printf("err: %d\n", err)
		fmt.Println("data: %d\n", data)
		if err != nil {
			_, _ = fmt.Fprint(os.Stderr, "dup3: %v \n", err)
			continue
		}
		for _, line := range strings.Split(string(data), "\n") {
			counts[line]++
		}
	}
	for line, n := range counts {
		if n > 1 {
			fmt.Printf("%d\t%s\n", n, line)
		}
	}
}
